import {
  UPDATEPAGEEDUCATIONINFORMATION,
  CLEARPAGEEDUCATIONINFORMATION
} from '../types/pageeducationinformation'
import { handleActions } from 'redux-actions'
import { getGlobalData } from '../../../../configuration/globaldata'

const education = getGlobalData('education')
const Schema = {
  showEmpty: false,
  requestOverFirst: false,
  networkerror: false,
  professionalname: '',
  submitid: '',
  schoolWrap: {
    value: ''
  },
  degreeValue: '',
  degreeList: education,
  degreeSource: education,
  dateInWrap: {
    value: '',
    mode: 'date'
  },
  dateOutWrap: {
    value: '',
    mode: 'date'
  },
  nowStatusWrap: {
    value: 0,
    list: [{ name: '已毕业', value: '1' }, { name: '未毕业', value: '2' }]
  }
}

export default handleActions(
  {
    [UPDATEPAGEEDUCATIONINFORMATION] (state, action) {
      return {
        ...state,
        ...action.payload
      }
    },
    [CLEARPAGEEDUCATIONINFORMATION] (state, action) {
      return {
        ...Schema
      }
    }
  },
  Schema
)
